// $Id: errno.c 49 2011-04-18 16:51:06Z cedric.shih@gmail.com $
/*
 * Copyright (C) 2010 Cedric Shih <cedric.shih@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "nio.h"

const char *nio_strerror(enum nio_errno err)
{
	switch (err) {
	case NIO_EOK:
		return "Success.";
	case NIO_EPERM:
		return "Operation not permitted.";
	case NIO_EINVAL:
		return "Invalid argument(s).";
	case NIO_ENOMEM:
		return "Out of memory.";
	case NIO_EOVERFLOW:
		return "Buffer overflows.";
	case NIO_EUNDERFLOW:
		return "Buffer underflows.";
	case NIO_ERANGE:
		return "Out of range.";
	case NIO_EOPENED:
		return "Channel closed.";
	case NIO_ECLOSED:
		return "Channel closed.";
	case NIO_EIO:
		return "I/O error.";
	case NIO_ECONNRESET:
		return "Connection reset by peer.";
	case NIO_EAGAIN:
		return "Try again later.";
	case NIO_ELOCK:
		return "Concurrent failure.";
	case NIO_EEXIST:
		return "Event pending.";
	case NIO_ENOENT:
		return "Event not pending.";
	case NIO_EINPROGRESS:
		return "Channel message pending";
	default:
		return "Unknown error.";
	}
}
